package endpoint

import (
	"context"
	"rpcdemo/service"

	"github.com/go-kit/kit/endpoint"
)

type TrimSpaceRequest struct {
	S string `json:"s"`
}

type TrimSpaceResponse struct {
	S string `json:"result"`
}

func MakeTrimSpaceEndpoint(svc service.TrimSvc) endpoint.Endpoint {
	return func(ctx context.Context, request interface{}) (interface{}, error) {
		req := request.(TrimSpaceRequest)
		result := svc.TrimSpace(req.S)
		return TrimSpaceResponse{result}, nil
	}
}
